// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IFileWrapper.cs" company="Concept Architecture">
//   (c) 2010 Muhammad Umer Farooq
// </copyright>
// <summary>
//   Defines the <seealso cref="IFileWrapper" /> interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Hisaab.Common.Wrappers
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Security.AccessControl;
    using System.Text;

    /// <summary>
    /// Defines the <seealso cref="IFileWrapper"/> interface.
    /// </summary>
    public interface IFileWrapper
    {
        #region Public Methods

        /// <summary>
        /// Appends all lines.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="contents">The contents.</param>
        void AppendAllLines(string path, IEnumerable<string> contents);

        /// <summary>
        /// Appends all lines.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="contents">The contents.</param>
        /// <param name="encoding">The encoding.</param>
        void AppendAllLines(string path, IEnumerable<string> contents, Encoding encoding);

        /// <summary>
        /// Appends all text.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="contents">The contents.</param>
        void AppendAllText(string path, string contents);

        /// <summary>
        /// Appends all text.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="contents">The contents.</param>
        /// <param name="encoding">The encoding.</param>
        void AppendAllText(string path, string contents, Encoding encoding);

        /// <summary>
        /// Appends the text.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Strem of file</returns>
        StreamWriter AppendText(string path);

        /// <summary>
        /// Copies the specified source file name.
        /// </summary>
        /// <param name="sourceFileName">Name of the source file.</param>
        /// <param name="destFileName">Name of the dest file.</param>
        void Copy(string sourceFileName, string destFileName);

        /// <summary>
        /// Copies the specified source file name.
        /// </summary>
        /// <param name="sourceFileName">Name of the source file.</param>
        /// <param name="destFileName">Name of the dest file.</param>
        /// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
        void Copy(string sourceFileName, string destFileName, bool overwrite);

        /// <summary>
        /// Creates the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Strem of file</returns>
        FileStream Create(string path);

        /// <summary>
        /// Creates the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="bufferSize">Size of the buffer.</param>
        /// <returns>Strem of file</returns>
        FileStream Create(string path, int bufferSize);

        /// <summary>
        /// Creates the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="bufferSize">Size of the buffer.</param>
        /// <param name="options">The options.</param>
        /// <returns>Strem of file</returns>
        FileStream Create(string path, int bufferSize, FileOptions options);

        /// <summary>
        /// Creates the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="bufferSize">Size of the buffer.</param>
        /// <param name="options">The options.</param>
        /// <param name="fileSecurity">The file security.</param>
        /// <returns>Strem of file</returns>
        FileStream Create(string path, int bufferSize, FileOptions options, FileSecurity fileSecurity);

        /// <summary>
        /// Creates the text.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Strem of file</returns>
        StreamWriter CreateText(string path);

        /// <summary>
        /// Decrypts the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        void Decrypt(string path);

        /// <summary>
        /// Deletes the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        void Delete(string path);

        /// <summary>
        /// Encrypts the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        void Encrypt(string path);

        /// <summary>
        /// Existses the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Value representing if the gile exists or not</returns>
        bool Exists(string path);

        /// <summary>
        /// Gets the access control.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>File attributes</returns>
        FileSecurity GetAccessControl(string path);

        /// <summary>
        /// Gets the access control.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="includeSections">The include sections.</param>
        /// <returns>File attributes</returns>
        FileSecurity GetAccessControl(string path, AccessControlSections includeSections);

        /// <summary>
        /// Gets the attributes.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>File attributes</returns>
        FileAttributes GetAttributes(string path);

        /// <summary>
        /// Gets the creation time.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Last write time UTC</returns>
        DateTime GetCreationTime(string path);

        /// <summary>
        /// Gets the creation time UTC.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Last write time UTC</returns>
        DateTime GetCreationTimeUtc(string path);

        /// <summary>
        /// Gets the last access time.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Last write time UTC</returns>
        DateTime GetLastAccessTime(string path);

        /// <summary>
        /// Gets the last access time UTC.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Last write time UTC</returns>
        DateTime GetLastAccessTimeUtc(string path);

        /// <summary>
        /// Gets the last write time.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Last write time UTC</returns>
        DateTime GetLastWriteTime(string path);

        /// <summary>
        /// Gets the last write time UTC.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Last write time UTC</returns>
        DateTime GetLastWriteTimeUtc(string path);

        /// <summary>
        /// Moves the specified source file name.
        /// </summary>
        /// <param name="sourceFileName">Name of the source file.</param>
        /// <param name="destFileName">Name of the dest file.</param>
        void Move(string sourceFileName, string destFileName);

        /// <summary>
        /// Opens the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="mode">The mode.</param>
        /// <returns>Stream for file</returns>
        FileStream Open(string path, FileMode mode);

        /// <summary>
        /// Opens the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="mode">The mode.</param>
        /// <param name="access">The access.</param>
        /// <returns>Stream for file</returns>
        FileStream Open(string path, FileMode mode, FileAccess access);

        /// <summary>
        /// Opens the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="mode">The mode.</param>
        /// <param name="access">The access.</param>
        /// <param name="share">The share.</param>
        /// <returns>Stream for file</returns>
        FileStream Open(string path, FileMode mode, FileAccess access, FileShare share);

        /// <summary>
        /// Opens the read.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Stream for file</returns>
        FileStream OpenRead(string path);

        /// <summary>
        /// Opens the text.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Stream for file</returns>
        StreamReader OpenText(string path);

        /// <summary>
        /// Opens the write.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Stream for file</returns>
        FileStream OpenWrite(string path);

        /// <summary>
        /// Reads all bytes.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Lines of text</returns>
        byte[] ReadAllBytes(string path);

        /// <summary>
        /// Reads all lines.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Lines of text</returns>
        string[] ReadAllLines(string path);

        /// <summary>
        /// Reads all lines.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="encoding">The encoding.</param>
        /// <returns>Lines of text</returns>
        string[] ReadAllLines(string path, Encoding encoding);

        /// <summary>
        /// Reads all text.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Text of file</returns>
        string ReadAllText(string path);

        /// <summary>
        /// Reads all text.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="encoding">The encoding.</param>
        /// <returns>Text of file</returns>
        string ReadAllText(string path, Encoding encoding);

        /// <summary>
        /// Reads the lines.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>Lines of text</returns>
        IEnumerable<string> ReadLines(string path);

        /// <summary>
        /// Reads the lines.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="encoding">The encoding.</param>
        /// <returns>Lines of text</returns>
        IEnumerable<string> ReadLines(string path, Encoding encoding);

        /// <summary>
        /// Replaces the specified source file name.
        /// </summary>
        /// <param name="sourceFileName">Name of the source file.</param>
        /// <param name="destinationFileName">Name of the destination file.</param>
        /// <param name="destinationBackupFileName">Name of the destination backup file.</param>
        void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName);

        /// <summary>
        /// Replaces the specified source file name.
        /// </summary>
        /// <param name="sourceFileName">Name of the source file.</param>
        /// <param name="destinationFileName">Name of the destination file.</param>
        /// <param name="destinationBackupFileName">Name of the destination backup file.</param>
        /// <param name="ignoreMetadataErrors">if set to <c>true</c> [ignore metadata errors].</param>
        void Replace(
            string sourceFileName,
            string destinationFileName,
            string destinationBackupFileName,
            bool ignoreMetadataErrors);

        /// <summary>
        /// Sets the access control.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="fileSecurity">The file security.</param>
        void SetAccessControl(string path, FileSecurity fileSecurity);

        /// <summary>
        /// Sets the attributes.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="fileAttributes">The file attributes.</param>
        void SetAttributes(string path, FileAttributes fileAttributes);

        /// <summary>
        /// Sets the creation time.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="creationTime">The creation time.</param>
        void SetCreationTime(string path, DateTime creationTime);

        /// <summary>
        /// Sets the creation time UTC.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="creationTimeUtc">The creation time UTC.</param>
        void SetCreationTimeUtc(string path, DateTime creationTimeUtc);

        /// <summary>
        /// Sets the last access time.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="lastAccessTime">The last access time.</param>
        void SetLastAccessTime(string path, DateTime lastAccessTime);

        /// <summary>
        /// Sets the last access time UTC.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="lastAccessTimeUtc">The last access time UTC.</param>
        void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc);

        /// <summary>
        /// Sets the last write time.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="lastWriteTime">The last write time.</param>
        void SetLastWriteTime(string path, DateTime lastWriteTime);

        /// <summary>
        /// Sets the last write time UTC.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="lastWriteTimeUtc">The last write time UTC.</param>
        void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc);

        /// <summary>
        /// Writes all bytes.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="bytes">The bytes.</param>
        void WriteAllBytes(string path, byte[] bytes);

        /// <summary>
        /// Writes all lines.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="contents">The contents.</param>
        void WriteAllLines(string path, string[] contents);

        /// <summary>
        /// Writes all lines.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="contents">The contents.</param>
        /// <param name="encoding">The encoding.</param>
        void WriteAllLines(string path, string[] contents, Encoding encoding);

        /// <summary>
        /// Writes all lines.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="contents">The contents.</param>
        void WriteAllLines(string path, IEnumerable<string> contents);

        /// <summary>
        /// Writes all lines.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="contents">The contents.</param>
        /// <param name="encoding">The encoding.</param>
        void WriteAllLines(string path, IEnumerable<string> contents, Encoding encoding);

        /// <summary>
        /// Writes all text.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="contents">The contents.</param>
        void WriteAllText(string path, string contents);

        /// <summary>
        /// Writes all text.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="contents">The contents.</param>
        /// <param name="encoding">The encoding.</param>
        void WriteAllText(string path, string contents, Encoding encoding);

        #endregion Public Methods
    }
}